Revert "fix(workspace url id bug): switch workspace bug "#567
Revert "fix(workspace url id bug): switch workspace bug "#567icecrasher321 merged 1 commit intostagingfrom
Conversation
This reverts commit 0049644.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
|
✅ No security or compliance issues detected. Reviewed everything up to 597f770. Security Overview
Detected Code Changes
Reply to this PR with |
There was a problem hiding this comment.
PR Summary
This PR reverts significant workspace switching and workflow ordering changes from PR #564, potentially reintroducing several critical issues.
- Removed crucial database sorting by
lastModified descinapps/sim/stores/workflows/registry/store.ts, impacting workflow display consistency - Reverted workspace transition handling in
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx, which may reintroduce race conditions during switching - Simplified but potentially problematic workspace ID handling in
apps/sim/app/workspace/[workspaceId]/w/page.tsx, removing safeguards against duplicate loading - Removed optimistic UI updates and error handling in
workspace-header.tsx, making workspace switching less resilient - Eliminated workflow sorting by creation date in
apps/sim/app/api/workflows/sync/route.ts, affecting ordered workflow display
6 files reviewed, 3 comments
Edit PR Review Bot Settings | Greptile
| // If deleted workspace was active, switch to another workspace | ||
| if (activeWorkspace?.id === id && updatedWorkspaces.length > 0) { | ||
| const newWorkspace = updatedWorkspaces[0] | ||
| setActiveWorkspace(newWorkspace) | ||
|
|
||
| // Use the specialized method for handling workspace deletion with explicit workspace ID | ||
| useWorkflowRegistry.getState().handleWorkspaceDeletion(newWorkspace.id) | ||
|
|
||
| // Update URL to the new workspace | ||
| router.push(`/workspace/${newWorkspace.id}/w`) | ||
| // Use the specialized method for handling workspace deletion | ||
| const newWorkspaceId = updatedWorkspaces[0].id | ||
| useWorkflowRegistry.getState().handleWorkspaceDeletion(newWorkspaceId) | ||
| setActiveWorkspace(updatedWorkspaces[0]) | ||
| } |
There was a problem hiding this comment.
logic: Missing router.push after workspace deletion. User may remain on deleted workspace URL.
| // If deleted workspace was active, switch to another workspace | |
| if (activeWorkspace?.id === id && updatedWorkspaces.length > 0) { | |
| const newWorkspace = updatedWorkspaces[0] | |
| setActiveWorkspace(newWorkspace) | |
| // Use the specialized method for handling workspace deletion with explicit workspace ID | |
| useWorkflowRegistry.getState().handleWorkspaceDeletion(newWorkspace.id) | |
| // Update URL to the new workspace | |
| router.push(`/workspace/${newWorkspace.id}/w`) | |
| // Use the specialized method for handling workspace deletion | |
| const newWorkspaceId = updatedWorkspaces[0].id | |
| useWorkflowRegistry.getState().handleWorkspaceDeletion(newWorkspaceId) | |
| setActiveWorkspace(updatedWorkspaces[0]) | |
| } | |
| // If deleted workspace was active, switch to another workspace | |
| if (activeWorkspace?.id === id && updatedWorkspaces.length > 0) { | |
| // Use the specialized method for handling workspace deletion | |
| const newWorkspaceId = updatedWorkspaces[0].id | |
| useWorkflowRegistry.getState().handleWorkspaceDeletion(newWorkspaceId) | |
| setActiveWorkspace(updatedWorkspaces[0]) | |
| // Navigate to the new workspace | |
| router.push(`/workspace/${newWorkspaceId}/w`) | |
| } |
| .from(workflow) | ||
| .where(eq(workflow.workspaceId, workspaceId)) | ||
| .orderBy(desc(workflow.createdAt)) | ||
| workflows = await db.select().from(workflow).where(eq(workflow.workspaceId, workspaceId)) |
There was a problem hiding this comment.
logic: Missing orderBy clause - workflows are no longer sorted by creation date which could affect frontend display order
| // If we have workflows, redirect to the first one | ||
| if (workflowIds.length > 0) { | ||
| router.replace(`/workspace/${workspaceId}/w/${workflowIds[0]}`) | ||
| return |
There was a problem hiding this comment.
logic: No verification that workflows belong to current workspace before redirect. Could cause incorrect routing
)" (simstudioai#567) This reverts commit 0049644.
Reverts #564